import VueRouter from "vue-router"
import Home from '../components/Home'
import Login from '../pages/user/Login'
import Register from '../pages/user/Register'
import MyMain from '../components/MyMain'
import UserInfo from '@/pages/user/UserInfo'
import Attraction from '@/pages/attraction/Attraction'
import News from '@/pages/news/News'
import MyLine from '@/pages/line/Line'
import AddAttraction from '@/pages/attraction/AddAttraction'
import AddNews from '@/pages/news/AddNews'
import ManageAttraction from '@/pages/attraction/ManageAttraction'
import ManageNews from '@/pages/news/ManageNews'
import AdminHome from '@/components/AdminHome'

export default new VueRouter({
    mode: 'history',
    routes: [
        // 配置默认路由
        {
            name: '/', path: '/', component: Home, redirect: '/index',
        },
        {
            name: 'home', path: '/home', component: Home,
            children: [
                { name: 'main', path: '/main', component: MyMain, },
                { name: 'index', path: '/index', component: MyMain, },

                { name: 'attraction', path: '/attraction', component: Attraction },
                { name: 'news', path: '/news', component: News },
                { name: 'line', path: '/line', component: MyLine },
            ]

        },
        {
            name: 'adminHome', path: '/adminHome', component: AdminHome,
            children: [
                { name: 'main', path: '/main', component: MyMain, },
                { name: 'index', path: '/index', component: MyMain, },
                { name: 'manageAttraction', path: '/manageAttraction', component: ManageAttraction },
                { name: 'manageNews', path: '/manageNews', component: ManageNews }
            ]
        },
        { name: 'login', path: '/login', component: Login, },
        { name: 'register', path: '/register', component: Register, },
        { name: 'userInfo', path: '/userInfo', component: UserInfo, props: true },
        { name: 'addAttraction', path: '/addAttraction', component: AddAttraction, props: true },
        { name: 'addNews', path: '/addNews', component: AddNews, props: true },

    ]
})